package com.ligotop.core.configs;


import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.URL;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

import javax.validation.constraints.Max;

/**
 * 测试配置文件
 */
@ConfigurationProperties(prefix = "TestConfig")
@PropertySource(value ="classpath:config/project.properties")
@Component
public class TestConfig {

    //检测配置的属性是否为url格式
    @URL
    private String url;

    //确定最大数值
    @Max(value = 99)
    private String maxLength;

    //不能为空
    @NotEmpty
    private String name;


    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getMaxLength() {
        return maxLength;
    }

    public void setMaxLength(String maxLength) {
        this.maxLength = maxLength;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "TestConfig{" +
                "url='" + url + '\'' +
                ", maxLength='" + maxLength + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
